<?php
class PostsModel extends RelationModel {
	protected $_link = array(
		'Content' => array(
			'mapping_type'	=> HAS_ONE,
			'mapping_name'	=>'Content',
			'class_name'	=>'Content',	//设置关联要查询的表
			'foreign_key'	=>'cid',		//设置外键
			'mapping_fields'=>'content',	//设置需要查询的列
			'as_fields'		=>'content',	//设置列的别名
		),
		'User' => array(
			'mapping_type'	=> BELONGS_TO,
			'class_name'	=>'User',		//设置关联要查询的表
			'foreign_key'	=>'uid',		//设置外键
			'mapping_fields'=>'nickname,url,countpost',	//设置需要查询的列
			'as_fields'		=>'nickname,url,countpost',	//设置列的别名
		)
	);
		
	public function  addPosts($data){
		return $this->relation(true)->add($data);
	}
	
	public function updatePost($pid){
		
	}
	
	public function getTableInfo(){
		$fields = $this->getDbFields();
	}
}